**Multi-Scale Terrain Texturing using Generative Adversarial Networks - Demo** ![A screenshot from the demo.](Terrain.png) Overview ======== This demo lets you explore a simple terrain with automatically generated detail maps as described in [#Klein17]. It acts as an interactive demonstration of the results. Several textures where used to generate detail maps; they can be viewed by changing the program options (see Section [Program Options]). For the grass texture, different kernel sizes where used to split the low frequency and high frequency map, which is helpful to understand the impact of the kernel size on the end result (the number in the name states the kernel size in pixels). In general, kernel size is an artistic choice, however a medium kernel size works well for most textures. The tiling factor of the detail maps (e.g. how often the high frequency texture is repeated to cover the whole low frequency texture) depends on the selected texture. Inside each texture folder is a `.cfg` file containing the right tiling factor. Generating new Textures =================== This demo only shows how to render the generated textures and how they compare to naive tiling. The generation process is described in the [#Klein17] and we plan to release the source code of the generation process along with some documentation at some point in the future. Controls ======== A short overview of the controls is printed to the console after program startup: Input | Action --------------------|---------------- Left mouse button | Rotate camera Right mouse button | Zoom camera `W`, `A`, `S`, `D` | Move camera `R`, `F` | Move camera up/down `T`, `G` | Next/previous texture `1` | Tiled texture mode `2` | Detail mapping mode Alt + Numpad [`0`..`9`] | Save camera 0..9 Numpad [`0`..`9`] | Load camera 0..9 Camera implementation ---------------------- The camera is always centered at an invisible focus point. This point can be moved with the keyboard (see above), and the camera can be rotated around this point using the mouse. Zooming will bring the camera closer / further away from the focus point. If you zoom all the way in, the camera essentially switches to an ego perspective mode, while zooming out is more of an spectator mode. Also, while zooming in and moving the camera forward might seem similar at first, they are fundamentally different operations, as the camera turns differently afterwards. We found that this system allows for a rather intuitive exploration of the terrain, once the basics are understood. Saving cameras -------------- Camera positions / orientations can be saved, which is very useful to create reproducible figures. Camera positions are saved to individual files inside the `SavedCameras` subfolder and the demo is shipped with some example files. Program Options =============== The demo has a couple of options that can be set by editing the `config.cfg` file in the main directory. !!! Warning Proper indentation (with tabs) is important for parsing `config.cfg`, so try to not mess with it. The options are: Terrain : Filename relative to the executable of a _wavefront obj_ model that is used as terrain mesh. Note, that the parser does not include all _obj_ features. Texture Folder : Folder relative to the executable where the two detail maps `HighFreq.png` and `LowFreq.png` are stored. Change this, to flip between different terrain textures. Camera MoveSpeed : Controls, how fast the camera is moved with the keyboard. Camera RotateSpeed : Controls, how fast the camera is turned, when the mouse is moved. Camera ZoomSpeed : Controls, how fast the camera is zooms, when the mouse is moved with pressed right button. Camera Perspective : Controls the _field of view_ of the camera. Shader ------ `Terrain.vs` and `Terrain.fs` contain the GLSL shader used for rendering the terrain. Editing these files is a somewhat advanced way to change the behavior of the demo. Even further customization is possible by editing the source code (see Section [Compiling]). Compiling ========== The demo ships with pre-compiled binaries, however it was not tested on a wide variety of platforms. But the source code is included, so that you should be able to compile it for your platform yourself. Platform --------- This demo was developed and tested on Windows 10 64bit, but in principle it should run on almost all major platforms (as all dependencies are cross platform). Visual Studio 2015 was used as compiler and the source code uses some of the newer C++ features, thus older compilers might not work. Dependencies ------------ The following libraries are required for compilation: - OpenGL (4.5) - [glfw](http://www.glfw.org/) (3.2.1) - [glm](https://glm.g-truc.net/) (0.9.8.3) - [boost](http://www.boost.org/) (1.66) Newer versions can obviously work as well, however the ones mentioned above were used during development. For simplicity, _glfw_ and _glm_ are bundled. Due to its size, _boost_ is not bundled, but in our experience the installation is mostly hassle free. If you use a different compiler than VS 2015, you might need to recompile _glfw_ yourself. Also you will need to compile _boost_ for 64bits, which can be done via `bjam address-model=64`. Project files ------------- Only project files for Visual Studio 2015 are provided, however creating your own ones should be easy; apart from the dependencies, no specific compiling options are used. The `boost.props` file links to the installation folder of _boost_, which likely needs to be changed on other machines. Contact ======= If you have any questions regarding the demo or the paper, you can try messaging me at . Bibliography ============ [#Klein17]: Jonathan Klein, Stefan Hartmann, Michael Weinmann and Dominik L. Michels. [**Multi-Scale Terrain Texturing using Generative Adversarial Networks**](http://cg.cs.uni-bonn.de/en/publications/paper-details/Klein-2010-TerrainSynthesis/) *In: Proceedings of Image and Vision Computing New Zealand, IEEE, 2017*